﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace RonaldCamcam.XBeeFramework
{
    public static class XBeeExtensions
    {        
        public static string ToHexString(this byte value)
        {
            return value.ToString("X");
        }

        public static string ToHexString(this List<byte> value)
        {
            string hex = string.Empty;
            foreach (byte b in value)
            {
                hex += b.ToHexString();
            }
            return hex;
        }

        public static string ToHexString(this byte[] value)
        {
            string hex = string.Empty;
            foreach (byte b in value)
            {
                hex += b.ToHexString();
            }
            return hex;
        }

        public static string ConvertoString(this List<byte> value, Encoding enc)
        {
            return enc.GetString(value.ToArray());            
        }
    }
}

